<?php

function send_email($options = array()) {
    
    $CI = & get_instance();
    $CI->load->library('email');

//        $title = $options['title']; //String
//        $message = $options['message']; //$this->load->view('');
//        $from_email = $options['from_email'];
//        $sender_name = $options['sender_name'];
//        $config = array(
//            'protocol' => 'smtp',
//            'smtp_host' => 'ssl://smtp.googlemail.com',
//            'smtp_port' => 465,
//            'smtp_user' => 'email_address@gmail.com', // change it to yours
//            'smtp_pass' => 'your_password', // change it to yours
//            'mailtype' => 'html',
//            'charset' => 'iso-8859-1',
//            'wordwrap' => TRUE
//        );
    $config = array(
        'protocol' => 'sendmail',
        'mailpath' => '/usr/sbin/sendmail',
        'mailtype' => 'html',
        'wordwrap' => FALSE
    );
    $CI->email->clear();
    $CI->email->initialize($config);
    $CI->email->from($options['sender_email'], $options['sender_name']);
    $CI->email->subject($options['subject']);
    $CI->email->message($options['message']);
    $CI->email->to($options['to_email']);
    if (isset($options['attach']))
        $CI->email->attach($options['attach']);

    $CI->email->send();
}
